﻿using Microsoft.EntityFrameworkCore;
using Panda.Net.Bases.FileStores.Repositories;
using Panda.Net.EntityFrameworkCore;
using System;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;

namespace Panda.Net.Bases.FileStores;

public class FileRepository : EfCoreRepository<NetDbContext, FileStore, Guid>, IFileRepository
{
    public FileRepository(IDbContextProvider<NetDbContext> dbContextProvider) : base(dbContextProvider)
    {
    }

    public async Task<FileStore?> GetByMd5Async(string md5)
    {
        return await (await GetDbSetAsync()).FirstOrDefaultAsync(a => a.Md5 == md5);
    }
}